/*
 * @Descripttion: 代理模式
 * @Author: lcx
 * @version: v01
 * @Date: 2023-10-17 23:02:55
 * @LastEditors: lcx
 * @LastEditTime: 2023-10-18 21:03:12
 */

interface Subject {
    public void buy();
}

class RealSubject {

    void buy() {
        System.out.println("RealSubject order car");
    }

}

class Proxy implements Subject {
    RealSubject realSubject;

    Proxy(RealSubject realSubject) {
        this.realSubject = realSubject;
    }

    public void buy() {
        realSubject.buy();
        System.out.println("proxy buy car");
    }
}

class test {
    public static void main(String[] args) {
        RealSubject realSubject = new RealSubject();
        Proxy proxy = new Proxy(realSubject);
        proxy.buy();

    }


}